import { readFileFinger } from '@/services/auditLog/fileSource';
import { queryFinger, queryGj } from '@/services/auditLog/fileSource';

export default {
  namespace: 'fileFingerModel',

  state: {
    // 列表数据
    data: {
      dataList: [],
      pageNum: 0,
      pageSize: 10,
      totalCount: 0,
    },
  },

  effects: {
    *readFileFinger({ payload, callback }, { call, put }) {
      const response = yield call(readFileFinger, payload);
      if (callback) callback(response);
    },
    *queryList({ payload }, { call, put }) {
      const response = yield call(queryFinger, payload);
      yield put({
        type: 'save',
        payload: response.data || {
          dataList: [],
          pageNum: 0,
          pageSize: 10,
          totalCount: 0,
        },
      });
    },
    *getGj({ payload, callback }, { call, put }) {
      const response = yield call(queryGj, payload);
      yield put({
        type: 'savegetGj',
        payload: response,
      });
      if (callback) callback(response);
    },
  },
  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        data: payload,
      };
    },
  },
};
